<%@page contentType="text/html; charset=UTF-8" %>
<html>
    <head><title>Table</title></head>
    <body>
        <table border="1">
            <thead>
                <tr>
                    <td>First Name</td>
                    <td>Last Name</td>
                    <td> </td>
                </tr>
            <thead>
            <body id="tb">
                <tr id="1st">
                    <td>张</td>
                    <td>三</td>
                    <td><input type="button" value="Add" onclick="add()">
                    <input type="button" value="Del" onclick="del(this)"></td>
                </tr>
            </body>
        </table>
    </body>
</html>
<script>
    function add(){
    var trObj = document.createElement("tr");
    trObj.id = new Date().getTime();
    trObj.innerHTML = "<td><input name= 'firstName'/></td><td><input name=' lastName'/></td><td><input type='button' value='Add' onclick = 'add()'><input type='button' value='Del' onclick = 'del(this)'></td>";
        document.getElementById("tb").appendChild(trObj);
    }
    function del (obj) {
        var trId = obj.parentNode.parentNode.id;
        var trObj = document.getElementById(trId);
        document.getElementById("tb").removeChild(trObj);
    }
</script>